import request from '@/utils/request'

// 查询文件列表
export function listFile(query) {
  return request({
    url: '/disk/file',
    method: 'get',
    params: query
  })
}

// 查询文件树构建
export function listFileTree(fileId, isDir) {
  return request({
    url: '/disk/file/tree',
    method: 'get',
    params: {
      fileId: fileId,
      isDir: isDir
    }
  })
}
//文件新建
export function addFile(query) {
  return request({
    url: '/disk/file',
    method: 'post',
    data: query
  })
}
// 查询文件虚拟路径
export function pathFile(fileId) {
  return request({
    url: '/disk/file/' + fileId + '/path',
    method: 'get',
  })
}
// 查询虚拟路径文件
export function searchPathFile(paths, userId) {
  return request({
    url: '/disk/path/file',
    method: 'get',
    params: {
      paths: paths,
      userId: userId
    }
  })
}
//文件查询
export function searcFile(fileId) {
  return request({
    url: '/disk/file/' + fileId,
    method: 'get',
  })
}

// 删除文件
export function delFile(fileId) {
  return request({
    url: '/disk/file/' + fileId,
    method: 'delete'
  })
}